package com.eaoa.uc.bustransfer.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.constants.AttachmentConstants;
import com.eaoa.constants.PubLogConstants;
import com.eaoa.query.bus.BusTransferQuery;
import com.eaoa.query.pub.PubBilllogQuery;
import com.eaoa.utils.AttachmentUtils;
import com.eaoa.vo.bus.BusTransfer;
import com.stony.core.util.CoreUtils;

public class BusTransferManageSearchExpandAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {

		Long transferno = CoreUtils.parseLong(request.getParameter("transferno"));

		BusTransfer customer = BusTransferQuery.loadByNOInitPubOrders(transferno);

		request.setAttribute("result", customer);

		if (transferno != null) {
			Map attachments = AttachmentUtils.getAttachmentMap(
					AttachmentConstants.ATTACHMENTTYPE_TRANSFER, transferno);
			request.setAttribute("attachments", attachments);
		}
		
		List billlogs = PubBilllogQuery.load(transferno, PubLogConstants.BILLTYPE_PUB_TRANSFER, PubLogConstants.LOGTYPE_BILLTRACE, "Y");
		request.setAttribute("billlogs", billlogs);

		return mapping.findForward("success");
	}
}
